﻿using UnityEngine;
using System.Collections;

public class ball : MonoBehaviour {
	
	public float initialSpeed = 1.0f;
	
	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
		if (transform.position.y > 25) 
	 	{ 
		 	scoreKeeping.player1Score += 1; 
		 	GameObject.Find("ballLauncher").SendMessage("LaunchBall", 1);
		 	Destroy(gameObject); 
	 	} 
	 	if (transform.position.y < -25) 
	 	{ 
		 	scoreKeeping.player2Score += 1;
		 	GameObject.Find("ballLauncher").SendMessage("LaunchBall", 2); 
		 	Destroy(gameObject); 
	 	} 
	}
	void OnCollisionEnter(Collision collision) 
	{ 
		audio.Play(); 
	}
}
